<?php
require 'db.php';
require 'function.php';
$category = new Manager($link);
$id = $_GET['id'];

    if (isset($_POST['submit'])){
        
        $Id = $_POST['Id'];
        $name = $_POST['name'];
        
        $query = $category->editCategory($Id,$name, $id);
        if ($query){
            header("Location:m_category.php");
        }
        else{
            echo "<script>alert('修改失败！');</script>";
            echo "<script>history.go(-1);</script>";
            exit();
        }
    }





$data = $category->getCategoryById($id);
require 'cedit.html';
?>